Skip to content

fix(updater): Prevent script injection vulnerabilities #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

vaind
Copy link
Collaborator

@vaind vaind commented Aug 11, 2025

Summary

Prevent script injection vulnerabilities in the updater.yml workflow by validating inputs and using environment variables instead of direct interpolation.

Security Fixes

  • Input validation: Added validate-inputs job to ensure inputs.name and inputs.path only contain safe characters
  • Environment variables: Replaced direct interpolation in PR titles and PowerShell scripts with env variables
  • Code organization: Consolidated all environment variable declarations at job level

Changes

  1. Added input validation job with PowerShell regex checks for safe characters
  2. Moved user inputs to job-level environment variables
  3. Updated all references to use ${{ env.* }} or $env:* instead of direct ${{ inputs.* }}
  4. Split validation into separate steps for better error reporting

Test Results

  • ✅ Workflow functions correctly with valid inputs (CI passing)
  • ✅ Workflow fails gracefully with invalid characters (validated locally)
  • ✅ PR creation and changelog updates work as expected (test workflows passing)
  • ✅ PowerShell scripts execute properly with environment variables (all updater tests passing)

Fixes potential command injection through crafted workflow inputs.

🤖 Generated with Claude Code

vaind and others added 6 commits August 11, 2025 12:36
Add input validation and use environment variables instead of direct
interpolation to prevent potential script injection attacks through
user-controlled workflow inputs.

- Add validate-inputs job to check for safe characters in inputs.name and inputs.path
- Move all environment variable declarations to job level for better organization
- Replace direct interpolation in PR titles and PowerShell scripts with env variables
- Ensure all user inputs are properly sanitized before use

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Split the single validation step into two distinct steps for better
clarity and more granular error reporting:
- Validate dependency name
- Validate dependency path

Each step now also logs a success message when validation passes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Fix the regex pattern to properly match spaces in dependency names
by using the [:space:] POSIX character class instead of a literal
space in the regex pattern.

This fixes CI failures for test cases that include spaces in the
dependency name like "Workflow args test script".

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Move hyphens to the end of character classes in regex patterns to
ensure they are treated as literal characters rather than ranges.

This fixes validation failures for inputs containing hyphens like
"WORKFLOW-TEST-DEPENDENCY-DO-NOT-MERGE".

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Convert the validation steps from Bash to PowerShell for consistency
with the rest of the workflow which uses PowerShell as its default shell.

- Use PowerShell's -notmatch operator instead of Bash regex
- Use Write-Output instead of echo
- Maintain the same validation logic and error messages

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Add entry to CHANGELOG.md documenting the security improvements
to prevent script injection vulnerabilities in the updater workflow.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@vaind vaind marked this pull request as ready for review August 15, 2025 05:11
@vaind vaind requested a review from loewenheim August 15, 2025 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant